home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-13 | 50.5 KB | 2,254 lines |
- *** 1.14 1993/05/29 21:16:07
- --- Changelo 1993/07/13 17:38:43
- ***************
- *** 313,315 ****
- --- 313,329 ----
- sync up with libg++ 2.3.1
-
- ---------------------------- Patchlevel 19 -----------------------------------
- +
- + RENAME iodtoa.cc to floatcon.cc due to gnu renaming. sorry about the
- + last patch, that tried to patch the wrong file.
- +
- + *.cc, *.h:: ++jrb
- + sync up with libg++ 2.3.10
- +
- + *.cc, *.h:: ++jrb
- + sync up with libg++ 2.3.91
- +
- + *.cc, *.h:: ++jrb
- + sync up with libg++ 2.4.0
- +
- + ---------------------------- Patchlevel 20 -----------------------------------
- *** 1.14 1993/05/29 21:16:07
- --- PatchLev.h 1993/07/13 17:38:44
- ***************
- *** 1,5 ****
-
- ! #define PatchLevel "19"
-
- /*
- * the Patch Level above is to identify the version
- --- 1,5 ----
-
- ! #define PatchLevel "20"
-
- /*
- * the Patch Level above is to identify the version
- *** 1.4 1992/06/03 02:12:17
- --- dtoa.cc 1993/07/13 17:38:46
- ***************
- *** 30,35 ****
- --- 30,36 ----
- #define M_LN10 2.30258509299404568402
- #endif
-
- + #ifdef __GNUC__ /* cfront cannot compile this routine */
- // OBSOLETE ROUTINE!
-
- char* dtoa(double fpnum, char cvt, int width, int prec)
- ***************
- *** 336,339 ****
-
- return fmtbase;
- }
- !
- --- 337,340 ----
-
- return fmtbase;
- }
- ! #endif
- *** 1.4 1993/02/05 04:59:04
- --- editbuf.cc 1993/07/13 17:38:46
- ***************
- *** 15,26 ****
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- - #include <ioprivat.h>
- - #include <editbuf.h>
- - #include <stddef.h>
- #ifdef __GNUG__
- #pragma implementation
- #endif
-
- /* NOTE: Some of the code here is taken from GNU emacs */
- /* Hence this file falls under the GNU License! */
- --- 15,26 ----
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- #ifdef __GNUG__
- #pragma implementation
- #endif
- + #include <ioprivat.h>
- + #include <editbuf.h>
- + #include <stddef.h>
-
- /* NOTE: Some of the code here is taken from GNU emacs */
- /* Hence this file falls under the GNU License! */
- *** 1.2 1992/06/03 02:12:17
- --- error.cc 1993/07/13 17:38:46
- ***************
- *** 21,26 ****
- --- 21,28 ----
- #include <builtin.h>
- #include <osfcn.h>
-
- + extern "C" _VOLATILE_VOID abort();
- +
- _VOLATILE_VOID default_one_arg_error_handler(const char* msg)
- {
- fputs("Error: ", stderr);
- *** 1.11 1993/05/29 21:16:07
- --- filebuf.cc 1993/07/13 17:38:47
- ***************
- *** 342,349 ****
- streampos delta = gptr() - egptr();
- if (in_backup())
- delta -= eGptr() - Gbase();
- ! if (sys_seek(delta, ios::cur) == EOF)
- ! return EOF;
- }
- // FIXME: Cleanup - can this be shared?
- // setg(base(), ptr, ptr);
- --- 342,352 ----
- streampos delta = gptr() - egptr();
- if (in_backup())
- delta -= eGptr() - Gbase();
- ! _G_fpos_t new_pos = sys_seek(delta, ios::cur);
- ! if (new_pos == EOF)
- ! return EOF;
- ! _fb._offset = new_pos;
- ! setg(eback(), gptr(), gptr());
- }
- // FIXME: Cleanup - can this be shared?
- // setg(base(), ptr, ptr);
- *** 1.4 1993/01/17 03:34:31
- --- fstream.cc 1993/07/13 17:38:47
- ***************
- *** 15,26 ****
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- - #define _STREAM_COMPAT
- - #include <ioprivat.h>
- - #include <fstream.h>
- #ifdef __GNUG__
- #pragma implementation
- #endif
-
- fstreambase::fstreambase()
- {
- --- 15,26 ----
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- #ifdef __GNUG__
- #pragma implementation
- #endif
- + #define _STREAM_COMPAT
- + #include <ioprivat.h>
- + #include <fstream.h>
-
- fstreambase::fstreambase()
- {
- *** 1.5 1993/02/05 04:59:04
- --- igetline.cc 1993/07/13 17:38:48
- ***************
- *** 16,21 ****
- --- 16,22 ----
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- #include <iostream.h>
- + #include <string.h>
-
- istream& istream::getline(char* buf, _G_size_t len, char delim)
- {
- *** 1.3 1993/02/05 04:59:04
- --- indstrea.cc 1993/07/13 17:38:48
- ***************
- *** 15,26 ****
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- - #include <indstrea.h>
- -
- #ifdef __GNUG__
- #pragma implementation
- #endif
-
- indirectbuf::indirectbuf(streambuf *get, streambuf *put, int delete_mode)
- : streambuf()
- {
- --- 15,26 ----
- // License along with this library; if not, write to the Free
- // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- #ifdef __GNUG__
- #pragma implementation
- #endif
-
- + #include <indstrea.h>
- +
- indirectbuf::indirectbuf(streambuf *get, streambuf *put, int delete_mode)
- : streambuf()
- {
- *** 1.10 1993/02/05 04:59:04
- --- iostream.cc 1993/07/13 17:38:49
- ***************
- *** 50,61 ****
- {
- if (ipfx1()) {
- int ch = _strbuf->sbumpc();
- ! if (ch == EOF) set(ios::eofbit|ios::failbit);
- ! else c = (char)ch;
- }
- return *this;
- }
-
- istream& istream::ignore(_G_size_t n1 /* = 1 */, int delim /* = EOF */)
- {
- long n = n1;
- --- 50,79 ----
- {
- if (ipfx1()) {
- int ch = _strbuf->sbumpc();
- ! if (ch == EOF) {
- ! set(ios::eofbit|ios::failbit);
- ! _gcount = 0;
- ! }
- ! else {
- ! c = (char)ch;
- ! _gcount = 1;
- ! }
- }
- return *this;
- }
-
- + int istream::peek()
- + {
- + if (!good())
- + return EOF;
- + if (_tie && rdbuf()->in_avail() == 0)
- + _tie->flush();
- + int ch = _strbuf->sgetc();
- + if (ch == EOF)
- + set(ios::eofbit);
- + return ch;
- + }
- +
- istream& istream::ignore(_G_size_t n1 /* = 1 */, int delim /* = EOF */)
- {
- long n = n1;
- ***************
- *** 151,186 ****
-
- istream& istream::operator>>(char* ptr)
- {
- ! if (ipfx0()) {
- ! register streambuf* sb = _strbuf;
- int ch = sb->sbumpc();
- if (ch == EOF)
- ! set(ios::eofbit|ios::failbit);
- ! else {
- ! int w = width(0);
- sb->sputbackc(ch);
- ! for (;;) {
- ! ch = sb->sbumpc();
- ! if (ch == EOF) {
- ! set(ios::eofbit);
- ! break;
- ! }
- ! else if (isspace(ch)) {
- ! sb->sputbackc(ch);
- ! break;
- ! }
- ! else if (w == 1) {
- ! set(ios::failbit);
- ! sb->sputbackc(ch);
- ! break;
- ! }
- ! else *ptr++ = ch;
- ! w--;
- ! }
- ! }
- ! }
- ! *ptr = '\0';
- ! return *this;
- }
-
- #if defined(__GNUC__) && (!defined(atarist))
- --- 169,203 ----
-
- istream& istream::operator>>(char* ptr)
- {
- ! register char *p = ptr;
- ! int w = width(0);
- ! if (ipfx0()) {
- ! register streambuf* sb = _strbuf;
- ! for (;;)
- ! {
- int ch = sb->sbumpc();
- if (ch == EOF)
- ! {
- ! set(p == ptr ? (ios::eofbit|ios::failbit) : (ios::eofbit));
- ! break;
- ! }
- ! else if (isspace(ch))
- ! {
- sb->sputbackc(ch);
- ! break;
- ! }
- ! else if (w == 1)
- ! {
- ! set(ios::failbit);
- ! sb->sputbackc(ch);
- ! break;
- ! }
- ! else *p++ = ch;
- ! w--;
- ! }
- ! }
- ! *p = '\0';
- ! return *this;
- }
-
- #if defined(__GNUC__) && (!defined(atarist))
- ***************
- *** 323,328 ****
- --- 340,350 ----
- ostream& ostream::operator<<(char c)
- {
- if (opfx()) {
- + #if 1
- + // This is what the cfront implementation does.
- + _strbuf->sputc(c);
- + #else
- + // This is what cfront documentation and current ANSI drafts say.
- int w = width(0);
- char fill_char = fill();
- register int padding = w > 0 ? w - 1 : 0;
- ***************
- *** 332,337 ****
- --- 354,360 ----
- sb->sputc(c);
- if (flags() & ios::left) // Left adjustment.
- while (--padding >= 0) sb->sputc(fill_char);
- + #endif
- osfx();
- }
- return *this;
- ***************
- *** 355,366 ****
- // Note that we use separate code for decimal, octal, and hex,
- // so we can divide by optimizable constants.
- if ((stream.flags() & ios::basefield) == ios::oct) { // Octal
- - if ((stream.flags() & ios::showbase) && (val != 0))
- - show_base = "0", show_base_len = 1;
- do {
- *--buf_ptr = (val & 7) + '0';
- val = val >> 3;
- } while (val != 0);
- }
- else if ((stream.flags() & ios::basefield) == ios::hex) { // Hex
- char *xdigs = (stream.flags() & ios::uppercase) ? "0123456789ABCDEF0X"
- --- 378,389 ----
- // Note that we use separate code for decimal, octal, and hex,
- // so we can divide by optimizable constants.
- if ((stream.flags() & ios::basefield) == ios::oct) { // Octal
- do {
- *--buf_ptr = (val & 7) + '0';
- val = val >> 3;
- } while (val != 0);
- + if ((stream.flags() & ios::showbase) && (val != 0))
- + *--buf_ptr = '0';
- }
- else if ((stream.flags() & ios::basefield) == ios::hex) { // Hex
- char *xdigs = (stream.flags() & ios::uppercase) ? "0123456789ABCDEF0X"
- ***************
- *** 369,382 ****
- *--buf_ptr = xdigs[val & 15];
- val = val >> 4;
- } while (val != 0);
- ! if (stream.flags() & ios::showbase) {
- show_base = xdigs + 16; // Either "0X" or "0x".
- show_base_len = 2;
- }
- }
- else { // Decimal
- - if (val != 0 && sign > 0 && (stream.flags() & ios::showpos))
- - show_pos=1;
- #ifdef __GNUC__
- // Optimization: Only use long long when we need to.
- while (val > UINT_MAX) {
- --- 392,403 ----
- *--buf_ptr = xdigs[val & 15];
- val = val >> 4;
- } while (val != 0);
- ! if ((stream.flags() & ios::showbase) && (val != 0)) {
- show_base = xdigs + 16; // Either "0X" or "0x".
- show_base_len = 2;
- }
- }
- else { // Decimal
- #ifdef __GNUC__
- // Optimization: Only use long long when we need to.
- while (val > UINT_MAX) {
- ***************
- *** 392,397 ****
- --- 413,420 ----
- *--buf_ptr = (ival % 10) + '0';
- ival /= 10;
- } while (ival != 0);
- + if (sign > 0 && (stream.flags() & ios::showpos))
- + show_pos=1;
- }
-
- _G_size_t buf_len = buf+WRITE_BUF_SIZE - buf_ptr;
- ***************
- *** 501,517 ****
-
- int fpprec = 0; // 'Extra' (suppressed) floating precision.
- int prec = precision();
- ! if (prec < 0) prec = 6; // default.
- ! else if (prec > MAXFRACT) {
- if (flags() & (ios::fixed|ios::scientific) & ios::showpos)
- fpprec = prec - MAXFRACT;
- prec = MAXFRACT;
- }
-
- // Do actual conversion.
- #ifdef USE_DTOA
- if (__outfloat(n, rdbuf(), format_char, width(0),
- ! precision(), flags(), 0, fill()) < 0)
- set(ios::badbit|ios::failbit); // ??
- #else
- int negative;
- --- 524,541 ----
-
- int fpprec = 0; // 'Extra' (suppressed) floating precision.
- int prec = precision();
- ! if (prec > MAXFRACT) {
- if (flags() & (ios::fixed|ios::scientific) & ios::showpos)
- fpprec = prec - MAXFRACT;
- prec = MAXFRACT;
- }
- + else if (prec <= 0 && !(flags() & ios::fixed))
- + prec = 6; /* default */
-
- // Do actual conversion.
- #ifdef USE_DTOA
- if (__outfloat(n, rdbuf(), format_char, width(0),
- ! prec, flags(), 0, fill()) < 0)
- set(ios::badbit|ios::failbit); // ??
- #else
- int negative;
- ***************
- *** 519,525 ****
- int sign = '\0';
- char *cp = buf;
- *cp = 0;
- ! int size = __cvt_double(n, precision(),
- flags() & ios::showpoint ? 0x80 : 0,
- &negative,
- format_char, cp, buf + sizeof(buf));
- --- 543,549 ----
- int sign = '\0';
- char *cp = buf;
- *cp = 0;
- ! int size = __cvt_double(n, prec,
- flags() & ios::showpoint ? 0x80 : 0,
- &negative,
- format_char, cp, buf + sizeof(buf));
- ***************
- *** 581,587 ****
- return *this;
- }
-
- ! ostream& ostream::operator<<(void *p)
- {
- if (opfx()) {
- form("%p", p);
- --- 605,611 ----
- return *this;
- }
-
- ! ostream& ostream::operator<<(const void *p)
- {
- if (opfx()) {
- form("%p", p);
- ***************
- *** 664,671 ****
-
- ostream& flush(ostream& outs)
- {
- ! outs.rdbuf()->overflow(EOF);
- ! return outs;
- }
-
- istream& ws(istream& ins)
- --- 688,694 ----
-
- ostream& flush(ostream& outs)
- {
- ! return outs.flush();
- }
-
- istream& ws(istream& ins)
- ***************
- *** 699,705 ****
-
- ostream& ends(ostream& outs)
- {
- ! outs.put(0);
- return outs;
- }
-
- --- 722,728 ----
-
- ostream& ends(ostream& outs)
- {
- ! outs.put('\0');
- return outs;
- }
-
- *** 1.12 1993/03/29 03:53:00
- --- mincl 1993/07/13 17:38:50
- ***************
- *** 18,24 ****
- IOSRC = editbuf.cc filebuf.cc fstream.cc igetline.cc indstrea.cc iostream.cc \
- makebuf.cc parsestr.cc sbufvfor.cc sbufvsca.cc sgetline.cc stdstrbu.cc \
- stdstrea.cc stream.cc streambu.cc strstrea.cc xplotfil.cc xsfile.cc \
- ! igetsb.cc iodtoa.cc outfloat.cc iomanip.cc stdiostr.cc
-
- OBJ = ident.o $(LIBSRC:.cc=.o) $(IOSRC:.cc=.o)
-
- --- 18,24 ----
- IOSRC = editbuf.cc filebuf.cc fstream.cc igetline.cc indstrea.cc iostream.cc \
- makebuf.cc parsestr.cc sbufvfor.cc sbufvsca.cc sgetline.cc stdstrbu.cc \
- stdstrea.cc stream.cc streambu.cc strstrea.cc xplotfil.cc xsfile.cc \
- ! igetsb.cc floatcon.cc outfloat.cc iomanip.cc stdiostr.cc
-
- OBJ = ident.o $(LIBSRC:.cc=.o) $(IOSRC:.cc=.o)
-
- *** 1.5 1993/05/29 21:16:07
- --- outfloat.cc 1993/07/13 17:38:51
- ***************
- *** 49,69 ****
- case 'f':
- mode = 3;
- break;
- - case 'F':
- - exp = 'e';
- - mode = 0;
- - skip_zeroes = 1;
- - type = 'g';
- - break;
- case 'e':
- - exp = 'e';
- - mode = 2;
- - precision++; // Add one to include digit before decimal point.
- - break;
- case 'E':
- ! exp = 'E';
- mode = 2;
- ! precision++; // Add one to include digit before decimal point.
- break;
- case 'g':
- case 'G':
- --- 49,60 ----
- case 'f':
- mode = 3;
- break;
- case 'e':
- case 'E':
- ! exp = type;
- mode = 2;
- ! if (precision != 999)
- ! precision++; // Add one to include digit before decimal point.
- break;
- case 'g':
- case 'G':
- ***************
- *** 76,85 ****
- --- 67,80 ----
- break;
- }
- /* Do the actual convension */
- + if (precision == 999 && mode != 3)
- + mode = 0;
- char *p = dtoa(value, mode, precision, &decpt, &sign, &end);
- register int i;
- int useful_digits = end-p;
- char *exponent_start = EBUF_END;
- + if (mode == 0)
- + precision = useful_digits;
- // Check if we need to emit an exponent.
- if (mode != 3 && decpt != 9999) {
- i = decpt - 1;
- *** 1.2 1993/02/05 04:59:04
- --- procbuf.cc 1993/07/13 17:38:51
- ***************
- *** 25,30 ****
- --- 25,31 ----
-
- #ifndef FORK
- #define FORK vfork
- + extern "C" _G_pid_t vfork(void);
- #endif
-
- procbuf::procbuf(const char *command, int mode) : filebuf()
- *** 1.8 1992/12/14 19:14:32
- --- regex.cc 1993/07/13 17:38:52
- ***************
- *** 31,36 ****
- --- 31,37 ----
- #else
- #ifdef sparc
- #include <alloca.h>
- + extern "C" void *__builtin_alloca(...);
- #else
- #ifdef _AIX
- #pragma alloca
- ***************
- *** 223,229 ****
-
- /* Store NUMBER in two contiguous bytes starting at DESTINATION. */
- #define STORE_NUMBER(destination, number) \
- ! { (destination)[0] = (number) & 0377; \
- (destination)[1] = (number) >> 8; }
-
- /* Same as STORE_NUMBER, except increment the destination pointer to
- --- 224,230 ----
-
- /* Store NUMBER in two contiguous bytes starting at DESTINATION. */
- #define STORE_NUMBER(destination, number) \
- ! { (destination)[0] = (char)((number) & 0377); \
- (destination)[1] = (number) >> 8; }
-
- /* Same as STORE_NUMBER, except increment the destination pointer to
- ***************
- *** 2504,2510 ****
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- /* Restore register info. */
- ! last_used_reg = (short) *--stackp;
-
- /* Make the ones that weren't saved -1 or 0 again. */
- for (this_reg = RE_NREGS - 1; this_reg > last_used_reg; this_reg--)
- --- 2505,2511 ----
- if (d >= string1 && d <= end1)
- dend = end_match_1;
- /* Restore register info. */
- ! last_used_reg = (short) (int) *--stackp;
-
- /* Make the ones that weren't saved -1 or 0 again. */
- for (this_reg = RE_NREGS - 1; this_reg > last_used_reg; this_reg--)
- ***************
- *** 2550,2556 ****
-
- /* Entry points compatible with 4.2 BSD regex library. */
-
- ! #ifndef emacs
-
- static struct re_pattern_buffer re_comp_buf;
-
- --- 2551,2557 ----
-
- /* Entry points compatible with 4.2 BSD regex library. */
-
- ! #if 0
-
- static struct re_pattern_buffer re_comp_buf;
-
- *** 1.6 1993/01/17 03:34:31
- --- sbufvsca.cc 1993/07/13 17:38:52
- ***************
- *** 97,103 ****
- int nread; /* number of characters consumed from fp */
- // Assignments to base and ccfn are just to suppress warnings from gcc.
- int base = 0; /* base argument to strtol/strtoul */
- ! u_long (*ccfn)(const char*, char**, int) = 0;
- // conversion function (strtol/strtoul)
- char ccltab[256]; /* character class table for %[...] */
- char buf[BUF]; /* buffer for numeric conversions */
- --- 97,104 ----
- int nread; /* number of characters consumed from fp */
- // Assignments to base and ccfn are just to suppress warnings from gcc.
- int base = 0; /* base argument to strtol/strtoul */
- ! typedef u_long (*strtoulfn)(const char*, char**, int);
- ! strtoulfn ccfn = 0;
- // conversion function (strtol/strtoul)
- char ccltab[256]; /* character class table for %[...] */
- char buf[BUF]; /* buffer for numeric conversions */
- ***************
- *** 178,190 ****
- /* FALLTHROUGH */
- case 'd':
- c = CT_INT;
- ! ccfn = (u_long (*)(const char, char**, int))strtol;
- base = 10;
- break;
-
- case 'i':
- c = CT_INT;
- ! ccfn = (u_long (*)(const char, char**, int))strtol;
- base = 0;
- break;
-
- --- 179,191 ----
- /* FALLTHROUGH */
- case 'd':
- c = CT_INT;
- ! ccfn = (strtoulfn)strtol;
- base = 10;
- break;
-
- case 'i':
- c = CT_INT;
- ! ccfn = (strtoulfn)strtol;
- base = 0;
- break;
-
- ***************
- *** 203,211 ****
- base = 10;
- break;
-
- ! case 'X': /* compat XXX */
- ! flags |= LONG;
- ! /* FALLTHROUGH */
- case 'x':
- flags |= PFXOK; /* enable 0x prefixing */
- c = CT_INT;
- --- 204,210 ----
- base = 10;
- break;
-
- ! case 'X':
- case 'x':
- flags |= PFXOK; /* enable 0x prefixing */
- c = CT_INT;
- ***************
- *** 214,223 ****
- break;
-
- #ifdef FLOATING_POINT
- ! case 'E': /* compat XXX */
- ! case 'F': /* compat */
- ! flags |= LONG;
- ! /* FALLTHROUGH */
- case 'e': case 'f': case 'g':
- c = CT_FLOAT;
- break;
- --- 213,219 ----
- break;
-
- #ifdef FLOATING_POINT
- ! case 'E': case 'F':
- case 'e': case 'f': case 'g':
- c = CT_FLOAT;
- break;
- ***************
- *** 267,273 ****
- if (isupper(c))
- flags |= LONG;
- c = CT_INT;
- ! ccfn = (u_long (*)(const char, char**, int))strtol;
- base = 10;
- break;
- }
- --- 263,269 ----
- if (isupper(c))
- flags |= LONG;
- c = CT_INT;
- ! ccfn = (strtoulfn)strtol;
- base = 10;
- break;
- }
- ***************
- *** 283,289 ****
- * that suppress this.
- */
- if ((flags & NOSKIP) == 0) {
- ! n = *_gptr;
- while (isspace(n)) {
- _gptr++;
- nread++;
- --- 279,285 ----
- * that suppress this.
- */
- if ((flags & NOSKIP) == 0) {
- ! n = (unsigned char)*_gptr;
- while (isspace(n)) {
- _gptr++;
- nread++;
- ***************
- *** 343,349 ****
- /* take only those things in the class */
- if (flags & SUPPRESS) {
- n = 0;
- ! while (ccltab[*_gptr]) {
- n++, _gptr++;
- if (--width == 0)
- break;
- --- 339,345 ----
- /* take only those things in the class */
- if (flags & SUPPRESS) {
- n = 0;
- ! while (ccltab[(unsigned char)*_gptr]) {
- n++, _gptr++;
- if (--width == 0)
- break;
- ***************
- *** 358,364 ****
- goto match_failure;
- } else {
- p0 = p = va_arg(ap, char *);
- ! while (ccltab[*_gptr]) {
- *p++ = *_gptr++;
- if (--width == 0)
- break;
- --- 354,360 ----
- goto match_failure;
- } else {
- p0 = p = va_arg(ap, char *);
- ! while (ccltab[(unsigned char)*_gptr]) {
- *p++ = *_gptr++;
- if (--width == 0)
- break;
- ***************
- *** 384,390 ****
- width = ~0;
- if (flags & SUPPRESS) {
- n = 0;
- ! while (!isspace(*_gptr)) {
- n++, _gptr++;
- if (--width == 0)
- break;
- --- 380,386 ----
- width = ~0;
- if (flags & SUPPRESS) {
- n = 0;
- ! while (!isspace((unsigned char)*_gptr)) {
- n++, _gptr++;
- if (--width == 0)
- break;
- ***************
- *** 396,402 ****
- nread += n;
- } else {
- p0 = p = va_arg(ap, char *);
- ! while (!isspace(*_gptr)) {
- *p++ = *_gptr++;
- if (--width == 0)
- break;
- --- 392,398 ----
- nread += n;
- } else {
- p0 = p = va_arg(ap, char *);
- ! while (!isspace((unsigned char)*_gptr)) {
- *p++ = *_gptr++;
- if (--width == 0)
- break;
- ***************
- *** 417,423 ****
- width = sizeof(buf) - 1;
- flags |= SIGNOK | NDIGITS | NZDIGITS;
- for (p = buf; width; width--) {
- ! c = *_gptr;
- /*
- * Switch on the character; `goto ok'
- * if we accept it as a part of number.
- --- 413,419 ----
- width = sizeof(buf) - 1;
- flags |= SIGNOK | NDIGITS | NZDIGITS;
- for (p = buf; width; width--) {
- ! c = (unsigned char)*_gptr;
- /*
- * Switch on the character; `goto ok'
- * if we accept it as a part of number.
- ***************
- *** 548,554 ****
- width = sizeof(buf) - 1;
- flags |= SIGNOK | NDIGITS | DPTOK | EXPOK;
- for (p = buf; width; width--) {
- ! c = *_gptr;
- /*
- * This code mimicks the integer conversion
- * code, but is much simpler.
- --- 544,550 ----
- width = sizeof(buf) - 1;
- flags |= SIGNOK | NDIGITS | DPTOK | EXPOK;
- for (p = buf; width; width--) {
- ! c = (unsigned char)*_gptr;
- /*
- * This code mimicks the integer conversion
- * code, but is much simpler.
- *** 1.2 1993/02/05 04:59:04
- --- stdiostr.cc 1993/07/13 17:38:53
- ***************
- *** 57,65 ****
-
- _G_ssize_t stdiobuf::sys_write(const void *buf, _G_size_t n)
- {
- ! return fwrite(buf, 1, n, _file);
- if (_fb._offset >= 0)
- _fb._offset += n;
- }
-
- _G_fpos_t stdiobuf::sys_seek(_G_fpos_t offset, _seek_dir dir)
- --- 57,66 ----
-
- _G_ssize_t stdiobuf::sys_write(const void *buf, _G_size_t n)
- {
- ! _G_ssize_t count = fwrite(buf, 1, n, _file);
- if (_fb._offset >= 0)
- _fb._offset += n;
- + return count;
- }
-
- _G_fpos_t stdiobuf::sys_seek(_G_fpos_t offset, _seek_dir dir)
- *** 1.6 1993/02/05 04:59:04
- --- stdstrbu.cc 1993/07/13 17:38:53
- ***************
- *** 70,80 ****
- 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, 0, 0, 0, 0, 0}
-
- #define DEF_FILEBUF(NAME, FD, CHAIN, FLAGS) \
- ! _fake_filebuf NAME[1] = {{FILEBUF_LITERAL(CHAIN, FLAGS), vt_filebuf, {FD}}};
-
- DEF_FILEBUF(__std_filebuf_0, 0, 0, _S_NO_WRITES);
- ! DEF_FILEBUF(__std_filebuf_1, 1, (streambuf*)__std_filebuf_0, _S_NO_READS);
- ! DEF_FILEBUF(__std_filebuf_2, 2, (streambuf*)__std_filebuf_1,
- _S_NO_READS+_S_UNBUFFERED);
-
- // Nest define the stdiobuf-bases objects.
- --- 70,80 ----
- 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, 0, 0, 0, 0, 0}
-
- #define DEF_FILEBUF(NAME, FD, CHAIN, FLAGS) \
- ! _fake_filebuf NAME = {FILEBUF_LITERAL(CHAIN, FLAGS), vt_filebuf, {FD}};
-
- DEF_FILEBUF(__std_filebuf_0, 0, 0, _S_NO_WRITES);
- ! DEF_FILEBUF(__std_filebuf_1, 1, (streambuf*)&__std_filebuf_0, _S_NO_READS);
- ! DEF_FILEBUF(__std_filebuf_2, 2, (streambuf*)&__std_filebuf_1,
- _S_NO_READS+_S_UNBUFFERED);
-
- // Nest define the stdiobuf-bases objects.
- ***************
- *** 82,88 ****
- #if !defined(vt_stdiobuf)
- #ifndef __GNUG__
- // This works for cfront.
- ! #define vt_stdiobuf __vtbl__7stdiobuf
- extern char vt_stdiobuf[1];
- #elif _G_DOLLAR_IN_LABEL
- extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$stdiobuf");
- --- 82,88 ----
- #if !defined(vt_stdiobuf)
- #ifndef __GNUG__
- // This works for cfront.
- ! #define vt_stdiobuf __vtbl__8stdiobuf
- extern char vt_stdiobuf[1];
- #elif _G_DOLLAR_IN_LABEL
- extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$stdiobuf");
- ***************
- *** 103,109 ****
- FILEBUF_LITERAL(CHAIN, (FLAGS)|_S_UNBUFFERED),\
- vt_stdiobuf, {FD}, FILE}};
-
- ! DEF_STDIOBUF(__stdin_stdiobuf, stdin, 0, (streambuf*)__std_filebuf_2,
- _S_NO_WRITES);
- DEF_STDIOBUF(__stdout_stdiobuf, stdout, 1, (streambuf*)__stdin_stdiobuf,
- _S_NO_READS);
- --- 103,109 ----
- FILEBUF_LITERAL(CHAIN, (FLAGS)|_S_UNBUFFERED),\
- vt_stdiobuf, {FD}, FILE}};
-
- ! DEF_STDIOBUF(__stdin_stdiobuf, stdin, 0, (streambuf*)&__std_filebuf_2,
- _S_NO_WRITES);
- DEF_STDIOBUF(__stdout_stdiobuf, stdout, 1, (streambuf*)__stdin_stdiobuf,
- _S_NO_READS);
- *** 1.5 1993/01/17 03:34:31
- --- stdstrea.cc 1993/07/13 17:38:53
- ***************
- *** 63,83 ****
- #undef cerr
- #undef clog
-
- ! #ifdef __GNUG__
- #define PAD 0 /* g++ allows 0-length arrays. */
- #else
- #define PAD 1
- #endif
- struct _fake_istream {
- struct myfields {
- _ios_fields *vb; /* pointer to virtual base class ios */
- _G_ssize_t _gcount;
- } mine;
- _ios_fields base;
- char filler[sizeof(struct istream)-sizeof(struct _ios_fields)+PAD];
- };
- struct _fake_ostream {
- struct myfields {
- _ios_fields *vb; /* pointer to virtual base class ios */
- } mine;
- _ios_fields base;
- --- 63,93 ----
- #undef cerr
- #undef clog
-
- ! #ifdef __GNUC__
- #define PAD 0 /* g++ allows 0-length arrays. */
- #else
- #define PAD 1
- #endif
- struct _fake_istream {
- struct myfields {
- + #ifdef __GNUC__
- _ios_fields *vb; /* pointer to virtual base class ios */
- _G_ssize_t _gcount;
- + #else
- + /* This is supposedly correct for cfront. */
- + _G_ssize_t _gcount;
- + void *vptr;
- + _ios_fields *vb; /* pointer to virtual base class ios */
- + #endif
- } mine;
- _ios_fields base;
- char filler[sizeof(struct istream)-sizeof(struct _ios_fields)+PAD];
- };
- struct _fake_ostream {
- struct myfields {
- + #ifndef __GNUC__
- + void *vptr;
- + #endif
- _ios_fields *vb; /* pointer to virtual base class ios */
- } mine;
- _ios_fields base;
- ***************
- *** 87,101 ****
- #define STD_STR(SBUF, TIE, EXTRA_FLAGS) \
- (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::skipws|EXTRA_FLAGS, ' ',0,0,6
-
- ! #define STREAM_DEF(TYPE, NAME, SBUF, TIE, EXTRA_FLAGS) \
- TYPE NAME = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }};
-
- ! STREAM_DEF(_fake_ostream, cout, COUT_SBUF, NULL, 0)
- ! STREAM_DEF(_fake_ostream, cerr, CERR_SBUF, (ostream*)&cout, ios::unitbuf)
- ! STREAM_DEF(_fake_istream, cin, CIN_SBUF, (ostream*)&cout, 0)
-
- /* Only for (partial) compatibility with AT&T's library. */
- ! STREAM_DEF(_fake_ostream, clog, CERR_SBUF, (ostream*)&cout, 0)
-
- // Switches between using __std_filebuf_{0,1,2} and
- // __std{in,out,err}_stdiobuf for standard streams. This is
- --- 97,120 ----
- #define STD_STR(SBUF, TIE, EXTRA_FLAGS) \
- (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::skipws|EXTRA_FLAGS, ' ',0,0,6
-
- ! #ifdef __GNUC__
- ! #define OSTREAM_DEF(TYPE, NAME, SBUF, TIE, EXTRA_FLAGS) \
- ! TYPE NAME = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }};
- ! #define ISTREAM_DEF(TYPE, NAME, SBUF, TIE, EXTRA_FLAGS) \
- TYPE NAME = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }};
- + #else
- + #define OSTREAM_DEF(TYPE, NAME, SBUF, TIE, EXTRA_FLAGS) \
- + TYPE NAME = { {0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }};
- + #define ISTREAM_DEF(TYPE, NAME, SBUF, TIE, EXTRA_FLAGS) \
- + TYPE NAME = { {0, 0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }};
- + #endif
-
- ! OSTREAM_DEF(_fake_ostream, cout, COUT_SBUF, NULL, 0)
- ! OSTREAM_DEF(_fake_ostream, cerr, CERR_SBUF, (ostream*)&cout, ios::unitbuf)
- ! ISTREAM_DEF(_fake_istream, cin, CIN_SBUF, (ostream*)&cout, 0)
-
- /* Only for (partial) compatibility with AT&T's library. */
- ! OSTREAM_DEF(_fake_ostream, clog, CERR_SBUF, (ostream*)&cout, 0)
-
- // Switches between using __std_filebuf_{0,1,2} and
- // __std{in,out,err}_stdiobuf for standard streams. This is
- *** 1.8 1993/02/05 04:59:04
- --- strstrea.cc 1993/07/13 17:38:54
- ***************
- *** 172,177 ****
- --- 172,183 ----
- _len = egptr() - ptr;
- }
-
- + void strstreambuf::init_static (const char *ptr, long size)
- + {
- + init_static((char*)ptr, size, NULL);
- + xsetflags(_S_NO_WRITES);
- + }
- +
- strstreambuf::~strstreambuf()
- {
- if (_base && !(_flags & _S_USER_BUF))
- ***************
- *** 182,189 ****
- streampos strstreambuf::seekoff(streamoff off, _seek_dir dir,
- int mode /*=ios::in|ios::out*/)
- {
- - _allocate_buffer = default_alloc;
- - _free_buffer = default_free;
- size_t cur_size = pcount();
- streampos new_pos = EOF;
-
- --- 188,193 ----
- *** 1.7 1992/12/14 19:14:32
- --- xbitset.cc 1993/07/13 17:38:55
- ***************
- *** 687,693 ****
- }
- }
-
- ! int BitSet::previous(int p, int b) const
- {
- if (--p < 0)
- return -1;
- --- 687,693 ----
- }
- }
-
- ! int BitSet::prev(int p, int b) const
- {
- if (--p < 0)
- return -1;
- ***************
- *** 770,776 ****
- if (b == rep->virt)
- return -1;
- else
- ! return previous((rep->len) * BITSETBITS, b);
- }
-
-
- --- 770,776 ----
- if (b == rep->virt)
- return -1;
- else
- ! return prev((rep->len) * BITSETBITS, b);
- }
-
-
- ***************
- *** 938,948 ****
- return s;
- }
-
- ! void BitSet::printon(ostream& s, char f, char t, char star) const
- // FIXME: Does not respect s.width()!
- {
- trim(rep);
- ! register streambuf* sb = s.rdbuf();
- const unsigned short* s = rep->s;
- const unsigned short* top = &(s[rep->len - 1]);
-
- --- 938,948 ----
- return s;
- }
-
- ! void BitSet::printon(ostream& os, char f, char t, char star) const
- // FIXME: Does not respect s.width()!
- {
- trim(rep);
- ! register streambuf* sb = os.rdbuf();
- const unsigned short* s = rep->s;
- const unsigned short* top = &(s[rep->len - 1]);
-
- *** 1.7 1992/12/14 19:14:32
- --- xbitstri.cc 1993/07/13 17:38:55
- ***************
- *** 978,984 ****
- }
- }
-
- ! int BitString::previous(int p, unsigned int b) const
- {
- if (--p < 0)
- return -1;
- --- 978,984 ----
- }
- }
-
- ! int BitString::prev(int p, unsigned int b) const
- {
- if (--p < 0)
- return -1;
- *** 1.2 1992/11/08 00:19:13
- --- xcomplex.cc 1993/07/13 17:38:56
- ***************
- *** 220,226 ****
- #else
- if (!s.ipfx(0))
- {
- ! s.set(ios::failbit); // Redundant if using GNU iostreams.
- return s;
- }
- #endif
- --- 220,226 ----
- #else
- if (!s.ipfx(0))
- {
- ! s.clear(ios::failbit|s.rdstate()); // Redundant if using GNU iostreams.
- return s;
- }
- #endif
- ***************
- *** 242,248 ****
- else
- i = 0;
- if (ch != ')')
- ! s.clear(_fail);
- }
- else
- {
- --- 242,248 ----
- else
- i = 0;
- if (ch != ')')
- ! s.clear(ios::failbit);
- }
- else
- {
- *** 1.5 1992/12/14 19:14:32
- --- xcursesw.cc 1993/07/13 17:38:56
- ***************
- *** 23,29 ****
- #include <values.h>
- #ifndef _OLD_STREAMS
- #include <strstream.h>
- ! #include <ioprivate.h>
- #endif
- // Include CurseW.h and/or curses.h *after* iostream includes,
- // because curses.h defines a clear macro that conflicts with iostream. Sigh.
- --- 23,29 ----
- #include <values.h>
- #ifndef _OLD_STREAMS
- #include <strstream.h>
- ! //#include <ioprivate.h>
- #endif
- // Include CurseW.h and/or curses.h *after* iostream includes,
- // because curses.h defines a clear macro that conflicts with iostream. Sigh.
- ***************
- *** 38,43 ****
- --- 38,61 ----
- *
- */
-
- + #if !defined(_IO_MAGIC) && !defined(HAVE_VSCANF) &&!defined vsscanf
- + extern "C" int _doscan(FILE *, const char*, va_list args);
- +
- + static int vsscanf(char *buf, const char * fmt, va_list args)
- + {
- + FILE b;
- + #ifdef _IOSTRG
- + b._flag = _IOREAD|_IOSTRG;
- + #else
- + b._flag = _IOREAD;
- + #endif
- + b._base = (unsigned char*)buf;
- + b._ptr = (unsigned char*)buf;
- + b._cnt = BUFSIZ;
- + return _doscan(&b, fmt, args);
- + }
- + #endif
- +
- /*
- * varargs functions are handled conservatively:
- * They interface directly into the underlying
- ***************
- *** 55,75 ****
- char buf[BUFSIZ];
- int result = wgetstr(w, buf);
- if (result == OK) {
- ! #ifndef _OLD_STREAMS
- strstreambuf ss(buf, BUFSIZ);
- result = ss.vscan(fmt, args);
- ! #else /* _OLD_STREAMS */
- ! #ifndef HAVE_VSCANF
- ! FILE b;
- ! b._flag = _IOREAD|_IOSTRG;
- ! b._base = buf;
- ! b._ptr = buf;
- ! b._cnt = BUFSIZ;
- ! result = _doscan(&b, fmt, args);
- ! #else /* HAVE_VSCANF */
- ! result = vsscanf(buf, fmt, args);
- ! #endif /* HAVE_VSCANF */
- ! #endif /* _OLD_STREAMS */
- }
- #endif /* !VMS */
- va_end(args);
- --- 73,85 ----
- char buf[BUFSIZ];
- int result = wgetstr(w, buf);
- if (result == OK) {
- !
- ! #ifdef _IO_MAGIC /* GNU iostreams */
- strstreambuf ss(buf, BUFSIZ);
- result = ss.vscan(fmt, args);
- ! #else
- ! result = vsscanf(buf, fmt, args);
- ! #endif
- }
- #endif /* !VMS */
- va_end(args);
- ***************
- *** 89,109 ****
- {
- result = wgetstr(w, buf);
- if (result == OK) {
- ! #ifndef _OLD_STREAMS
- strstreambuf ss(buf, BUFSIZ);
- result = ss.vscan(fmt, args);
- - #else /* OLD_STREAMS */
- - #ifndef HAVE_VSCANF
- - FILE b;
- - b._flag = _IOREAD|_IOSTRG;
- - b._base = buf;
- - b._ptr = buf;
- - b._cnt = BUFSIZ;
- - result = _doscan(&b, fmt, args);
- #else
- ! result = vsscanf(buf, fmt, args);
- #endif
- - #endif /* OLD_STREAMS */
- }
- }
- #endif /* !VMS */
- --- 99,110 ----
- {
- result = wgetstr(w, buf);
- if (result == OK) {
- ! #ifdef _IO_MAGIC /* GNU iostreams */
- strstreambuf ss(buf, BUFSIZ);
- result = ss.vscan(fmt, args);
- #else
- ! result = vsscanf(buf, fmt, args);
- #endif
- }
- }
- #endif /* !VMS */
- ***************
- *** 116,137 ****
- va_list args;
- va_start(args, fmt);
- char buf[BUFSIZ];
- - #ifndef _OLD_STREAMS
- - strstreambuf ss(buf, BUFSIZ);
- - ss.vform(fmt, args);
- - ss.sputc(0);
- - #else /* _OLD_STREAMS */
- - #ifndef HAVE_VPRINTF
- - FILE b;
- - b._flag = _IOWRT|_IOSTRG;
- - b._ptr = buf;
- - b._cnt = BUFSIZ;
- - _doprnt(fmt, args, &b);
- - putc('\0', &b);
- - #else
- vsprintf(buf, fmt, args);
- - #endif
- - #endif /* _OLD_STREAMS */
- va_end(args);
- return waddstr(w, buf);
- }
- --- 117,123 ----
- ***************
- *** 145,166 ****
- if (result == OK)
- {
- char buf[BUFSIZ];
- - #ifndef _OLD_STREAMS
- - strstreambuf ss(buf, BUFSIZ);
- - ss.vform(fmt, args);
- - ss.sputc(0);
- - #else /* _OLD_STREAMS */
- - #ifndef HAVE_VPRINTF
- - FILE b;
- - b._flag = _IOWRT|_IOSTRG;
- - b._ptr = buf;
- - b._cnt = BUFSIZ;
- - _doprnt(fmt, args, &b);
- - putc('\0', &b);
- - #else
- vsprintf(buf, fmt, args);
- - #endif
- - #endif /* _OLD_STREAMS */
- result = waddstr(w, buf);
- }
- va_end(args);
- --- 131,137 ----
- *** 1.6 1992/12/14 19:14:32
- --- xfix.cc 1993/07/13 17:38:57
- ***************
- *** 101,107 ****
- return _new_Fix(len);
- }
-
- ! _Fix new_Fix(uint16 len, _Fix x)
- {
- _Fix z = _new_Fix(len);
- return copy(x,z);
- --- 101,107 ----
- return _new_Fix(len);
- }
-
- ! _Fix new_Fix(uint16 len, const _Fix x)
- {
- _Fix z = _new_Fix(len);
- return copy(x,z);
- ***************
- *** 139,145 ****
-
- // convert to a double
-
- ! double value(Fix& x)
- {
- double d = 0.0;
- for ( int i=x.rep->siz-1; i >= 0; i-- )
- --- 139,145 ----
-
- // convert to a double
-
- ! double value(const Fix& x)
- {
- double d = 0.0;
- for ( int i=x.rep->siz-1; i >= 0; i-- )
- ***************
- *** 158,164 ****
- Integer a = 1, b=1;
- for ( int i=0; i < x.rep->siz; i++ )
- {
- ! a = (a << 16) + x.rep->s[i];
- b <<= 16;
- }
- return a-b;
- --- 158,165 ----
- Integer a = 1, b=1;
- for ( int i=0; i < x.rep->siz; i++ )
- {
- ! a <<= 16;
- ! a += x.rep->s[i];
- b <<= 16;
- }
- return a-b;
- ***************
- *** 181,187 ****
- return 0;
- }
-
- ! int compare(_Fix x, _Fix y)
- {
- if ( x->siz == y->siz )
- return docmp(x->s, y->s, x->siz);
- --- 182,188 ----
- return 0;
- }
-
- ! int compare(const _Fix x, const _Fix y)
- {
- if ( x->siz == y->siz )
- return docmp(x->s, y->s, x->siz);
- ***************
- *** 292,298 ****
- b += r->s[k];
- r->s[k] = b;
- }
- ! if ( k < r->siz + 1 )
- carry = (a >> 15) + (b >> 16);
- }
- r->s[i] = carry;
- --- 293,299 ----
- b += r->s[k];
- r->s[k] = b;
- }
- ! if ( k < (int)r->siz + 1 )
- carry = (a >> 15) + (b >> 16);
- }
- r->s[i] = carry;
- ***************
- *** 452,463 ****
-
- extern AllocRing _libgxx_fmtq;
-
- ! void Fix::printon(ostream& s, int width)
- {
- char format[20];
- double val = value(*this);
- int old_precision = s.precision(width-3);
- ! ios::fmtflags old_flags = s.setf(ios::fixed, ios::fixed|ios::scientific);
- if (val >= 0)
- s << ' ';
- s.width(width-2);
- --- 453,464 ----
-
- extern AllocRing _libgxx_fmtq;
-
- ! void Fix::printon(ostream& s, int width) const
- {
- char format[20];
- double val = value(*this);
- int old_precision = s.precision(width-3);
- ! long old_flags = s.setf(ios::fixed, ios::fixed|ios::scientific);
- if (val >= 0)
- s << ' ';
- s.width(width-2);
- ***************
- *** 487,511 ****
- istream& operator >> (istream& s, Fix& y)
- {
- int got_one = 0;
- - #ifdef _OLD_STREAMS
- - if (!s.good())
- - {
- - return s;
- - }
- - #else
- if (!s.ipfx(0))
- {
- ! s.set(ios::failbit); // Redundant if using GNU iostreams.
- return s;
- }
- - #endif
-
- char sign = 0, point = 0;
- char ch;
- s >> ws;
- if (!s.good())
- {
- ! s.set(_fail);
- return s;
- }
- while (s.get(ch))
- --- 488,505 ----
- istream& operator >> (istream& s, Fix& y)
- {
- int got_one = 0;
- if (!s.ipfx(0))
- {
- ! s.clear(ios::failbit|s.rdstate()); // Redundant if using GNU iostreams.
- return s;
- }
-
- char sign = 0, point = 0;
- char ch;
- s >> ws;
- if (!s.good())
- {
- ! s.clear(ios::failbit|s.rdstate());
- return s;
- }
- while (s.get(ch))
- ***************
- *** 542,548 ****
- if (s.good())
- s.putback(ch);
- if (!got_one)
- ! s.set(_fail);
- else
- y = atoF(p);
- _libgxx_io_ob.free(p);
- --- 536,542 ----
- if (s.good())
- s.putback(ch);
- if (!got_one)
- ! s.clear(ios::failbit|s.rdstate());
- else
- y = atoF(p);
- _libgxx_io_ob.free(p);
- ***************
- *** 596,619 ****
- else
- {
- r->s[0] = 0x7fff;
- ! for ( int i=1; i < r->siz; i++ )
- r->s[i] = 0xffff;
- mask(r);
- }
- }
-
- ! void Fix_overflow_wrap(_Fix& r) {}
-
- void Fix_overflow_warning_saturate(_Fix& r) {
- Fix_overflow_warning(r);
- Fix_overflow_saturate(r);
- }
-
- ! void Fix_overflow_warning(_Fix& r) {
- cerr << "Fix: overflow warning\n";
- }
-
- ! void Fix_overflow_error(_Fix& r) {
- cerr << "Fix: overflow error\n";
- abort();
- }
- --- 590,613 ----
- else
- {
- r->s[0] = 0x7fff;
- ! for ( int i = 1; i < (int)r->siz; i++ )
- r->s[i] = 0xffff;
- mask(r);
- }
- }
-
- ! void Fix_overflow_wrap(_Fix&) {}
-
- void Fix_overflow_warning_saturate(_Fix& r) {
- Fix_overflow_warning(r);
- Fix_overflow_saturate(r);
- }
-
- ! void Fix_overflow_warning(_Fix&) {
- cerr << "Fix: overflow warning\n";
- }
-
- ! void Fix_overflow_error(_Fix&) {
- cerr << "Fix: overflow error\n";
- abort();
- }
- *** 1.1 1992/03/22 07:42:32
- --- xfix16.cc 1993/07/13 17:38:57
- ***************
- *** 69,75 ****
- }
-
-
- ! Fix32 operator * (Fix32& a, Fix32& b)
- {
- // break a and b into lo and hi parts, and do a multiple-precision
- // multiply, with rounding
- --- 69,75 ----
- }
-
-
- ! Fix32 operator * (const Fix32& a, const Fix32& b)
- {
- // break a and b into lo and hi parts, and do a multiple-precision
- // multiply, with rounding
- ***************
- *** 92,98 ****
- return Fix32(p);
- }
-
- ! Fix16 operator / (Fix16& a, Fix16& b)
- {
- short q;
- int apos = (a.m >= 0);
- --- 92,98 ----
- return Fix32(p);
- }
-
- ! Fix16 operator / (const Fix16& a, const Fix16& b)
- {
- short q;
- int apos = (a.m >= 0);
- ***************
- *** 114,120 ****
- return Fix16(q);
- }
-
- ! Fix32 operator / (Fix32& a, Fix32& b)
- {
- long q;
- int apos = (a.m >= 0);
- --- 114,120 ----
- return Fix16(q);
- }
-
- ! Fix32 operator / (const Fix32& a, const Fix32& b)
- {
- long q;
- int apos = (a.m >= 0);
- ***************
- *** 150,171 ****
-
- // error handling
-
- ! void Fix16::overflow(short& i)
- {
- (*Fix16_overflow_handler)(i);
- }
-
- ! void Fix32::overflow(long& i)
- {
- (*Fix32_overflow_handler)(i);
- }
-
- ! void Fix16::range_error(short& i)
- {
- (*Fix16_range_error_handler)(i);
- }
-
- ! void Fix32::range_error(long& i)
- {
- (*Fix32_range_error_handler)(i);
- }
- --- 150,171 ----
-
- // error handling
-
- ! void Fix16::overflow(short& i) const
- {
- (*Fix16_overflow_handler)(i);
- }
-
- ! void Fix32::overflow(long& i) const
- {
- (*Fix32_overflow_handler)(i);
- }
-
- ! void Fix16::range_error(short& i) const
- {
- (*Fix16_range_error_handler)(i);
- }
-
- ! void Fix32::range_error(long& i) const
- {
- (*Fix32_range_error_handler)(i);
- }
- *** 1.3 1992/06/03 02:12:17
- --- xfix24.cc 1993/07/13 17:38:57
- ***************
- *** 86,92 ****
- }
-
-
- ! Fix48 operator * (Fix24& a, Fix24& b)
- {
- // break a and b into lo and hi parts, and do a multiple-precision
- // multiply, with rounding
- --- 86,92 ----
- }
-
-
- ! Fix48 operator * (const Fix24& a, const Fix24& b)
- {
- // break a and b into lo and hi parts, and do a multiple-precision
- // multiply, with rounding
- ***************
- *** 120,126 ****
- return r;
- }
-
- ! Fix24 operator / (Fix24& a, Fix24& b)
- {
- long q;
- int apos = (a.m >= 0);
- --- 120,126 ----
- return r;
- }
-
- ! Fix24 operator / (const Fix24& a, const Fix24& b)
- {
- long q;
- int apos = (a.m >= 0);
- ***************
- *** 151,161 ****
- q += 0x80; // Round result to 24 bits
- if (apos != bpos) q = -q; // Fix sign
- }
- ! return (q & 0xffffff00);
- }
-
-
- ! Fix48 operator + (Fix48& f, Fix48& g)
- {
- long lo_r = (f.m.l >> 8) + (g.m.l >> 8);
- twolongs r;
- --- 151,161 ----
- q += 0x80; // Round result to 24 bits
- if (apos != bpos) q = -q; // Fix sign
- }
- ! return (q & ~0xFF);
- }
-
-
- ! Fix48 operator + (const Fix48& f, const Fix48& g)
- {
- long lo_r = (f.m.l >> 8) + (g.m.l >> 8);
- twolongs r;
- ***************
- *** 167,173 ****
- return r;
- }
-
- ! Fix48 operator - (Fix48& f, Fix48& g)
- {
- unsigned lo_r = (f.m.l >> 8) - (g.m.l >> 8);
- twolongs r;
- --- 167,173 ----
- return r;
- }
-
- ! Fix48 operator - (const Fix48& f, const Fix48& g)
- {
- unsigned lo_r = (f.m.l >> 8) - (g.m.l >> 8);
- twolongs r;
- ***************
- *** 179,185 ****
- return r;
- }
-
- ! Fix48 operator * (Fix48& a, long b)
- {
- twolongs r;
- int bpos = (b >= 0);
- --- 179,185 ----
- return r;
- }
-
- ! Fix48 operator * (const Fix48& a, long b)
- {
- twolongs r;
- int bpos = (b >= 0);
- ***************
- *** 204,212 ****
- return r;
- }
-
- ! Fix48 operator << (Fix48& a, int b)
- {
- ! twolongs r; r.u = r.l = 0;
- if ( b >= 0 )
- if ( b < 24 ) {
- r.u = (a.m.u << b) + ((a.m.l >> (24 - b)) & 0xffffff00L);
- --- 204,212 ----
- return r;
- }
-
- ! Fix48 operator << (const Fix48& a, int b)
- {
- ! twolongs r; r.u = 0; r.l = 0;
- if ( b >= 0 )
- if ( b < 24 ) {
- r.u = (a.m.u << b) + ((a.m.l >> (24 - b)) & 0xffffff00L);
- ***************
- *** 218,226 ****
- return r;
- }
-
- ! Fix48 operator >> (Fix48& a, int b)
- {
- ! twolongs r; r.u = r.l = 0;
- if ( b >= 0 )
- if ( b < 24 ) {
- r.l = (a.m.u << (24 - b)) + ((a.m.l >> b) & 0xffffff00L);
- --- 218,226 ----
- return r;
- }
-
- ! Fix48 operator >> (const Fix48& a, int b)
- {
- ! twolongs r; r.u = 0; r.l = 0;
- if ( b >= 0 )
- if ( b < 24 ) {
- r.l = (a.m.u << (24 - b)) + ((a.m.l >> b) & 0xffffff00L);
- ***************
- *** 239,260 ****
-
- // error handling
-
- ! void Fix24::overflow(long& i)
- {
- (*Fix24_overflow_handler)(i);
- }
-
- ! void Fix48::overflow(twolongs& i)
- {
- (*Fix48_overflow_handler)(i);
- }
-
- ! void Fix24::range_error(long& i)
- {
- (*Fix24_range_error_handler)(i);
- }
-
- ! void Fix48::range_error(twolongs& i)
- {
- (*Fix48_range_error_handler)(i);
- }
- --- 239,260 ----
-
- // error handling
-
- ! void Fix24::overflow(long& i) const
- {
- (*Fix24_overflow_handler)(i);
- }
-
- ! void Fix48::overflow(twolongs& i) const
- {
- (*Fix48_overflow_handler)(i);
- }
-
- ! void Fix24::range_error(long& i) const
- {
- (*Fix24_range_error_handler)(i);
- }
-
- ! void Fix48::range_error(twolongs& i) const
- {
- (*Fix48_range_error_handler)(i);
- }
- *** 1.3 1992/12/14 19:14:32
- --- xgetopt.cc 1993/07/13 17:38:58
- ***************
- *** 24,29 ****
- --- 24,30 ----
- #define alloca __builtin_alloca
- #elif defined(sparc)
- #include <alloca.h>
- + extern "C" void *__builtin_alloca(...);
- #elif defined(_AIX)
- #pragma alloca
- #else
- *** 1.9 1993/05/29 21:16:07
- --- xinteger.cc 1993/07/13 17:38:58
- ***************
- *** 468,474 ****
- {
- Integer q, r;
- divide(num, den, q, r);
- ! double d1 = double(q);
-
- if (d1 >= DBL_MAX || d1 <= -DBL_MAX || sign(r) == 0)
- return d1;
- --- 468,474 ----
- {
- Integer q, r;
- divide(num, den, q, r);
- ! double d1 = q.as_double();
-
- if (d1 >= DBL_MAX || d1 <= -DBL_MAX || sign(r) == 0)
- return d1;
- ***************
- *** 1822,1834 ****
- {
- int bw = (unsigned long)b / I_SHIFT;
- int sw = (unsigned long)b % I_SHIFT;
- ! if (x.rep == 0)
- ! x.rep = Icalloc(0, bw + 1);
- ! else if (x.rep->len < bw)
- ! {
- ! int xl = x.rep->len;
- x.rep = Iresize(x.rep, calc_len(xl, bw+1, 0));
- - }
- x.rep->s[bw] |= (1 << sw);
- Icheck(x.rep);
- }
- --- 1822,1830 ----
- {
- int bw = (unsigned long)b / I_SHIFT;
- int sw = (unsigned long)b % I_SHIFT;
- ! int xl = x.rep ? x.rep->len : 0;
- ! if (xl <= bw)
- x.rep = Iresize(x.rep, calc_len(xl, bw+1, 0));
- x.rep->s[bw] |= (1 << sw);
- Icheck(x.rep);
- }
- ***************
- *** 1837,1853 ****
- void clearbit(Integer& x, long b)
- {
- if (b >= 0)
- - {
- - int bw = (unsigned long)b / I_SHIFT;
- - int sw = (unsigned long)b % I_SHIFT;
- - if (x.rep == 0)
- - x.rep = Icalloc(0, bw + 1);
- - else if (x.rep->len < bw)
- {
- ! int xl = x.rep->len;
- ! x.rep = Iresize(x.rep, calc_len(xl, bw+1, 0));
- ! }
- ! x.rep->s[bw] &= ~(1 << sw);
- Icheck(x.rep);
- }
- }
- --- 1833,1848 ----
- void clearbit(Integer& x, long b)
- {
- if (b >= 0)
- {
- ! if (x.rep == 0)
- ! x.rep = &_ZeroRep;
- ! else
- ! {
- ! int bw = (unsigned long)b / I_SHIFT;
- ! int sw = (unsigned long)b % I_SHIFT;
- ! if (x.rep->len > bw)
- ! x.rep->s[bw] &= ~(1 << sw);
- ! }
- Icheck(x.rep);
- }
- }
- ***************
- *** 2308,2321 ****
- #else
- if (!s.ipfx(0))
- {
- ! s.set(ios::failbit);
- return s;
- }
- #endif
- s >> ws;
- if (!s.good())
- {
- ! s.set(ios::failbit);
- return s;
- }
-
- --- 2303,2316 ----
- #else
- if (!s.ipfx(0))
- {
- ! s.clear(ios::failbit|s.rdstate());
- return s;
- }
- #endif
- s >> ws;
- if (!s.good())
- {
- ! s.clear(ios::failbit|s.rdstate());
- return s;
- }
-
- ***************
- *** 2395,2401 ****
- if (s.good())
- s.putback(ch);
- if (!got_one)
- ! s.set(ios::failbit);
-
- if (sgn == '-')
- y.negate();
- --- 2390,2396 ----
- if (s.good())
- s.putback(ch);
- if (!got_one)
- ! s.clear(ios::failbit|s.rdstate());
-
- if (sgn == '-')
- y.negate();
- *** 1.5 1993/05/29 21:16:07
- --- xrationa.cc 1993/07/13 17:39:00
- ***************
- *** 188,194 ****
-
- Rational pow(const Rational& x, const Integer& y)
- {
- ! long yy = long(y);
- return pow(x, yy);
- }
-
- --- 188,194 ----
-
- Rational pow(const Rational& x, const Integer& y)
- {
- ! long yy = y.as_long();
- return pow(x, yy);
- }
-
- ***************
- *** 346,352 ****
-
- ostream& operator << (ostream& s, const Rational& y)
- {
- ! if (y.denominator() == 1)
- s << y.numerator();
- else
- {
- --- 346,352 ----
-
- ostream& operator << (ostream& s, const Rational& y)
- {
- ! if (y.denominator() == 1L)
- s << y.numerator();
- else
- {
- ***************
- *** 367,373 ****
- #else
- if (!s.ipfx(0))
- {
- ! s.set(ios::failbit); // Redundant if using GNU iostreams.
- return s;
- }
- #endif
- --- 367,373 ----
- #else
- if (!s.ipfx(0))
- {
- ! s.clear(ios::failbit|s.rdstate()); // Redundant if using GNU iostreams.
- return s;
- }
- #endif
- ***************
- *** 405,415 ****
- int
- Rational::fits_in_float() const
- {
- ! return FLT_MIN <= *this && *this <= FLT_MAX;
- }
-
- int
- Rational::fits_in_double() const
- {
- ! return DBL_MIN <= *this && *this <= DBL_MAX;
- }
- --- 405,415 ----
- int
- Rational::fits_in_float() const
- {
- ! return Rational (FLT_MIN) <= *this && *this <= Rational (FLT_MAX);
- }
-
- int
- Rational::fits_in_double() const
- {
- ! return Rational (DBL_MIN) <= *this && *this <= Rational (DBL_MAX);
- }
- *** 1.3 1992/12/14 19:14:32
- --- xregex.cc 1993/07/13 17:39:00
- ***************
- *** 28,36 ****
- #include <new.h>
- #include <builtin.h>
-
- ! // extern "C" {
- #include <regex.h>
- ! // }
-
- #include <xregex.h>
-
- --- 28,36 ----
- #include <new.h>
- #include <builtin.h>
-
- ! extern "C" {
- #include <regex.h>
- ! }
-
- #include <xregex.h>
-
- *** 1.4 1992/11/08 00:19:13
- --- xstring.cc 1993/07/13 17:39:02
- ***************
- *** 1201,1223 ****
-
- istream& operator>>(istream& s, String& x)
- {
- - #ifdef _OLD_STREAMS
- - if (!s.good())
- - {
- - return s;
- - }
- - s >> ws;
- - if (!s.good())
- - {
- - return s;
- - }
- - #else
- if (!s.ipfx(0) || (!(s.flags() & ios::skipws) && !ws(s)))
- {
- ! s.set(ios::failbit); // Redundant if using GNU iostreams.
- return s;
- }
- - #endif
- int ch;
- int i = 0;
- x.rep = Sresize(x.rep, 20);
- --- 1201,1211 ----
-
- istream& operator>>(istream& s, String& x)
- {
- if (!s.ipfx(0) || (!(s.flags() & ios::skipws) && !ws(s)))
- {
- ! s.clear(ios::failbit|s.rdstate()); // Redundant if using GNU iostreams.
- return s;
- }
- int ch;
- int i = 0;
- x.rep = Sresize(x.rep, 20);
- ***************
- *** 1232,1252 ****
- }
- x.rep->s[i] = 0;
- x.rep->len = i;
- ! if (i == 0) s.set(_fail);
- ! if (ch == EOF) s.set(_eof);
- return s;
- }
-
- int readline(istream& s, String& x, char terminator, int discard)
- {
- - #ifdef _OLD_STREAMS
- - if (!s.good())
- - #else
- if (!s.ipfx(0))
- - #endif
- - {
- return 0;
- - }
- int ch;
- int i = 0;
- x.rep = Sresize(x.rep, 80);
- --- 1220,1236 ----
- }
- x.rep->s[i] = 0;
- x.rep->len = i;
- ! int new_state = s.rdstate();
- ! if (i == 0) new_state |= ios::failbit;
- ! if (ch == EOF) new_state |= ios::eofbit;
- ! s.clear(new_state);
- return s;
- }
-
- int readline(istream& s, String& x, char terminator, int discard)
- {
- if (!s.ipfx(0))
- return 0;
- int ch;
- int i = 0;
- x.rep = Sresize(x.rep, 80);
- ***************
- *** 1264,1270 ****
- }
- x.rep->s[i] = 0;
- x.rep->len = i;
- ! if (ch == EOF) s.set(_eof);
- return i;
- }
-
- --- 1248,1254 ----
- }
- x.rep->s[i] = 0;
- x.rep->len = i;
- ! if (ch == EOF) s.clear(ios::eofbit|s.rdstate());
- return i;
- }
-
- ***************
- *** 1324,1330 ****
-
- int SubString::OK() const
- {
- ! int v = S != 0; // have a String;
- v &= S.OK(); // that is legal
- v &= pos + len >= S.rep->len;// pos and len within bounds
- if (!v) S.error("SubString invariant failure");
- --- 1308,1314 ----
-
- int SubString::OK() const
- {
- ! int v = S != (const char*)0; // have a String;
- v &= S.OK(); // that is legal
- v &= pos + len >= S.rep->len;// pos and len within bounds
- if (!v) S.error("SubString invariant failure");
-